//	getTop();
//	var iTime = setInterval(getTop, 5000);
	
	// 试用JSON传输数据，修正IE6下jQuery解析XML的错误
	function getTop(){
		$.post("bg-top-json-procedure.php", {
			action: 'getTop'
			}, function(data, textStatus){
				//alert( data );
				addMsg( data );
			}, 'json');
		$("#test")prepend( " Q " );
	} //END func getTop()

	function addMsg(data){
		$("#top-sell").empty();
		$("#top-buy").empty();
		var sell = 1;
		var buy = 5;
		$.each(data['top'], function(i,n){
			if( n['flag'] == '4'){
				if(sell%2 == 0) {
					var msg = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr bgcolor=\"#3676B4\"><td width=\"13%\" height=\"23\" class=\"yellow\">卖"
						+sell+"</td><td width=\"51%\" align=\"center\">"
						+n['price']+"K币</td><td width=\"36%\" align=\"center\">"
						+n['num']+"手</td></tr></table>";
				}else
					var msg = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"13%\" height=\"23\" class=\"yellow\">卖"
							+sell+"</td><td width=\"51%\" align=\"center\">"
							+n['price']+"K币</td><td width=\"36%\" align=\"center\">"
							+n['num']+"手</td></tr></table>";
				$("#top-sell").prepend( msg );
				sell++;
			}else if( n['flag'] == '3'){
				if(buy%2 == 0) {
					var msg = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr bgcolor=\"#3676B4\"><td width=\"13%\" height=\"23\" class=\"yellow\">买"
						+buy+"</td><td width=\"51%\" align=\"center\">"
						+n['price']+"K币</td><td width=\"36%\" align=\"center\">"
						+n['num']+"手</td></tr></table>";
				}else
					var msg = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"13%\" height=\"23\" class=\"yellow\">买"
							+buy+"</td><td width=\"51%\" align=\"center\">"
							+n['price']+"K币</td><td width=\"36%\" align=\"center\">"
							+n['num']+"手</td></tr></table>";
				$("#top-buy").prepend( msg );
				buy--;
			}

		});
	} //END func addMsg

//$("#loading").ajaxStart(function(){ $(this).show(); }); 
//$("#loading").ajaxStop(function(){ $(this).hide(); }); 
